package com.wuhuahe.learning.servlet;


import com.lagou.edu.servlet.api.HttpProtocolUtil;
import com.lagou.edu.servlet.api.HttpServlet;
import com.lagou.edu.servlet.api.Request;
import com.lagou.edu.servlet.api.Response;

import java.io.IOException;

public class CustomerServlet extends HttpServlet {

    @Override
    public void doGet(Request req, Response resp) {
        System.out.println("CustomerServlet doGet process......");

        String content = "<h1>CustomerServlet get</h1>";
        try {
            resp.output((HttpProtocolUtil.getHttpHeader200(content.getBytes().length) + content));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void doPost(Request req, Response resp) {
        System.out.println("CustomerServlet doPost process......");
        String content = "<h1>CustomerServlet post</h1>";
        try {
            resp.output((HttpProtocolUtil.getHttpHeader200(content.getBytes().length) + content));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    @Override
    public void init() throws Exception {

    }

    @Override
    public void destory() throws Exception {

    }
}
